package algotradingfx;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

import algotradingfx.strategies.*;
import algotradingfx.utils.Constants;
import atp.client.ATPRuntime;
import atp.client.BrokerDetails;
import atp.gui.MainGUI;

public class App {
	public static void main(String[] args) throws IOException {
		// Init
		System.out.println("initializing the app...");
		String ssID = "116";
		String password = "16817865";
		ArrayList<BrokerDetails> brokers = new ArrayList<BrokerDetails>();
		brokers.add(new BrokerDetails(ssID, null, null, null, Constants.MOCK_BROKER));
		ATPRuntime atpRuntime = new ATPRuntime(ssID, password, brokers);
		atpRuntime.init();
		
		// Start market 
		//atpRuntime.addStrategy(new MovingAveragePushStrategy(ssID, password));
		atpRuntime.addStrategy(new TickerPlant(ssID, password));
		atpRuntime.start();
		
		// Show GUI
		//MainGUI.showGUI(ssID, password);

		// Do not really know
		InputStreamReader converter = new InputStreamReader(System.in);
		BufferedReader in = new BufferedReader(converter);
		try {
			in.readLine();
		} catch (IOException e) {
		}

		System.out.println("deinitializing the app...");
	}
}